package com.ylr.base.config;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2022-02-14 14:02:20
 * className: RabbitMQConfig RabbitMQ配置类
 * version: 1.0
 * description:
 *  `@EnableRabbit`：开启RabbitMQ
 */
@Configuration
@EnableRabbit
public class RabbitMQConfig {

    /**
     * 自定义消息信息格式化方式，使用JACKSON工具进行JSON序列化传输
     */
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }

}
